<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>绑定属性</title>
    <script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
    <script crossorigin src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
    <style >
        .active:hover {
            width: 90px;
        }
        .active {
            width: 80px;
        }
    </style>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
    const root = ReactDOM.createRoot(document.getElementById('root'))

    class App extends React.Component {
        constructor(props) {
            super();
            this.state = {
                title: 'hhh',
                image: 'https://www.babeljs.cn/img/babel.png',
                isActive: true
            }
        }
        render() {
            // 解构
            const { title, image, isActive } = this.state;
            const classList = ['abc']
            if (isActive) {
                classList.push('active')
            }
            return (
                <div>
                    <h1>绑定属性</h1>
                    <h5 title={title}>绑定了属性</h5>
                    <span>绑定class</span><img className={classList.join(" ")} src={image} alt="绑定了class"/>
                    <p style={{color: "blue", fontSize: '30px'}}>绑定style</p>
                </div>
            )
        }
    }
    root.render(<App />);
</script>
</body>
</html>